#include "person.h"

// Make person object
Person::Person(QWidget * _parent, int x, int y)
{
    this->setParent(_parent); // set the parent

    // Initialize this label
    this->setGeometry(x - 12, y, 24, 36);

    // Set up movie
    animMovie = new QMovie();
    animMovie->setParent(this);

    // Set up Object ID
    int tempID;
    tempID = ((HelicopterForm*)(this->parent()))->GetFreeObjectID();
    this->setObjectName(QString::number(tempID) + "p");

    // Add the movie
    SetPersonMovie("images/personfall.mng");

    // Create the timer to make it move
    PerTimer *timer = new PerTimer(((HelicopterForm*)(this->parent())), tempID);
    timer->object = this;
}

void Person::SetPersonMovie(QString link)
{
    // Add the movie
    animMovie->stop();
    animMovie->setFileName(link);
    this->setMovie(animMovie);

    animMovie->setSpeed(500);
    animMovie->start();
}
